package towerDefense.towers;

import java.awt.image.BufferedImage;
import towerDefense.circlesprites.Circle;


public class CircleSprite extends TargetableSprite
{
    protected double myRadius;


    public CircleSprite ()
    {};


    public CircleSprite (double r)
    {
        super();
        setUp(r);
    }


    /**
     * @param r
     */
    private void setUp (double r)
    {
        myRadius = r;
        myTargetOutline = this.getCircle();
    }


    public CircleSprite (BufferedImage image, double x, double y, double r)
    {
        super(image, x, y, null);
        setUp(r);
    }


    public CircleSprite (BufferedImage image, double r)
    {
        super(image, null);
        setUp(r);
    }


    public CircleSprite (double x, double y, double r)
    {
        super(x, y, null);
        setUp(r);
    }


    public double getRadius ()
    {
        return myRadius;
    }


    public void setRadius (double r)
    {
        this.myRadius = r;
    }


    protected Circle getCircle ()
    {
        return new Circle(this.getCenterX(), this.getCenterY(), myRadius);
    }


    /**
     * Returns the center of the sprite in <code>x</code> coordinate (x +
     * (width/2)).
     */
    public double getCenterX ()
    {
        return this.getX() + (this.width / 2);
    }


    /**
     * Returns the center of the sprite in <code>y</code> coordinate (y +
     * (height/2)).
     */
    public double getCenterY ()
    {
        return this.getY() + (this.height / 2);
    }

}
